package factory;

public class FoodFactory {
    public Food createBread() {
        return new Bread();
    }

    public Food createApple() {
        return new Apple();
    }
}

abstract class Food {
    public abstract void eat();
}

class Bread extends Food {
    public void eat() {
        System.out.println("eat bread");
    }
}

class Apple extends Food {
    public void eat() {
        System.out.println("eat apple");
    }
}
